#最后一步识别人脸
#-*- coding: utf-8 -*-

import cv2
import numpy as np
from face_train_use_keras import Model




if __name__ == '__main__':

    # 加载模型
    model = Model()
    model.load_model(file_path='C:/Users/LCG/Desktop/data/test/me.face.model5.h5')

    # 输入测试图片
    img = cv2.imread("C:/Users/LCG/Desktop/data/cat.4003.jpg", 1)
    img_data = np.array(img)

    # print(img_data)
    # 图像灰化，降低计算复杂度
    # gray = cv2.cvtColor(img_data, cv2.COLOR_BGR2GRAY)

    faceID = model.face_predict(img_data)
    print(faceID)
    # 如果是“我”
    if faceID == 0:
        print("this is cat")
    elif faceID == 1:
        print("this is dog")
